/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* vim:set et sts=4: */
/* IBust - IBus with Traditional interface
 * Copyright(c) 2013 Daniel Sun
 * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
 * Copyright (C) 2008-2010 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#if !defined (__IBUST_H_INSIDE__) && !defined (IBUST_COMPILATION)
#error "Only <ibust.h> can be included directly"
#endif

/**
 * SECTION: ibustattrlist
 * @Title: IBustAttrList
 * @Short_description: AttrList of IBustText.
 * @See_also: #IBustAttribute #IBustText
 * @Stability: Stable
 *
 */
#ifndef __IBUST_ATTRIBUTE_LIST_H_
#define __IBUST_ATTRIBUTE_LIST_H_

#include "ibustattribute.h"

G_BEGIN_DECLS

/*
 * Type macros.
 */
/* define IBustAttrList macros */
#define IBUST_TYPE_ATTR_LIST             \
    (ibust_attr_list_get_type ())
#define IBUST_ATTR_LIST(obj)             \
    (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUST_TYPE_ATTR_LIST, IBustAttrList))
#define IBUST_ATTR_LIST_CLASS(klass)     \
    (G_TYPE_CHECK_CLASS_CAST ((klass), IBUST_TYPE_ATTR_LIST, IBustAttrListClass))
#define IBUST_IS_ATTR_LIST(obj)          \
    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUST_TYPE_ATTR_LIST))
#define IBUST_IS_ATTR_LIST_CLASS(klass)  \
    (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUST_TYPE_ATTR_LIST))
#define IBUST_ATTR_LIST_GET_CLASS(obj)   \
    (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUST_TYPE_ATTR_LIST, IBustAttrListClass))


typedef struct _IBustAttrList IBustAttrList;
typedef struct _IBustAttrListClass IBustAttrListClass;

/**
 * IBustAttrList:
 * @attributes: GArray that holds #IBustAttribute.
 *
 * Array of IBustAttribute.
 */
struct _IBustAttrList {
    IBustSerializable parent;

    /*< public >*/
    GArray *attributes;
};

struct _IBustAttrListClass {
    IBustSerializableClass parent;
};

/**
 * ibust_attr_list_get_type:
 * @returns: GType of IBustAttrList.
 *
 * Returns GType of IBustAttrList.
 */
GType                ibust_attr_list_get_type    ();

/**
 * ibust_attr_list_new:
 * @returns: A newly allocated IBustAttrList.
 *
 * New an IBustAttrList.
 */
IBustAttrList        *ibust_attr_list_new         ();

/**
 * ibust_attr_list_append:
 * @attr_list: An IBustAttrList instance.
 * @attr: The IBustAttribute instance to be appended.
 *
 * Append an IBustAttribute to IBustAttrList, and increase reference.
 */
void                 ibust_attr_list_append      (IBustAttrList   *attr_list,
                                                 IBustAttribute  *attr);
/**
 * ibust_attr_list_get:
 * @attr_list: An IBustAttrList instance.
 * @index: Index of the @attr_list.
 * @returns: (transfer none): IBustAttribute at given index, NULL if no such IBustAttribute.
 *
 * Returns IBustAttribute at given index. Borrowed reference.
 */
IBustAttribute       *ibust_attr_list_get         (IBustAttrList   *attr_list,
                                                 guint           index);

G_END_DECLS
#endif

